package demo8;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sr=new Scanner(System.in);
        String a=sr.next();
        while(!a.equals("end")){
            if(a.length()%3==0){
                System.out.print(a+" ");
            }
            a=sr.next();
        }
    }
}
